package com.hontech.bvapp2.ui.parts.heat

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.Button
import android.widget.FrameLayout
import com.hontech.bvapp2.R
import com.hontech.bvapp2.device.cp.Heat
import com.hontech.bvapp2.ui.dialog.runProg
import com.hontech.bvapp2.ui.view.LabelInput
import com.hontech.bvapp2.utils.onClick

class HeatNozzleParts (context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) {

    init {
        val view = LayoutInflater.from(context).inflate(R.layout.parts_heat_nozzle_motor, this)
        val ctrl = view.findViewById<Button>(R.id.id_heat_nozzle_btn)
        val li = view.findViewById<LabelInput>(R.id.id_heat_nozzle_li)

        ctrl.onClick {
            runProg("喷嘴", "控制") {
                val p = li.textInt()
                Heat.nozzleCtrl(p)
            }
        }
    }
}